/**
@author		Jong Min, Lee
@date		  02/11/2014
@breif		study work space class

copyright(c) Tae Young Soft. All right reserved. 2014
*/
#pragma once

#include "Taurus_Util/Macros.h"

//forward declarations
class CStudySet;
class CStudyViewController;

/**
@brief  study work space class
*/
class CStudyWorkSpace
{
private:
  /**
  @brief		state flags
  */
  enum 
  {
     SWS_MAXIMIZED =    0x00000001,
     SWS_HAS_FOCUS =    0x00000010
  };

private:
  /**
  @brief		default contructor
  */
  CStudyWorkSpace();

  DISALLOW_COPY_AND_ASSIGN(CStudyWorkSpace);

public:
  friend class CViewerController;

  /**
  @brief		destructor
  */
  ~CStudyWorkSpace();

  /**
  @brief		check whether study work space has focus or not
  @return		TRUE if study work space has focus, FALSE if not
  */
  inline BOOL hasFocus() const
  {
    return (theState & SWS_HAS_FOCUS) == SWS_HAS_FOCUS;
  }

  /**
  @brief		check whether study work space is maximized
  @return		TRUE if study work space is maximized, FALSE if not
  */
  inline BOOL isMaximized() const
  {
    return (theState & SWS_MAXIMIZED) == SWS_MAXIMIZED;
  }

  inline BOOL isVacant() const
  {
    return theStudySet == NULL;
  }

  inline BOOL isOccupied() const
  {
    return theStudySet != NULL;
  }

private:
  /**
  @brief		set focus
  @param		focus flag whether study workspace will have focus or not
  @param    redraw flag indicating whether study view title bar is to be redrawn
  @return		ERROR_SUCCESS if succeeds, an error code otherwise
  */
  DWORD setFocus(BOOL focus, BOOL redraw);

private:

  //base unique id
  static unsigned int theBaseUID;

  //unique id of study workspace
  const unsigned int theUniqueID;

  //pointer to study set
  CStudySet* theStudySet;

  //pointer to study view controller
  CStudyViewController* theViewController;

  //state flags
  unsigned int theState;

  //the window's coordinates when study view is in the restored position
  CRect theNormalPosition;
};
